/**
 * @Author 12629
 * @Description：
 */
public class Login {
    public String userName = "admin";
    public String passWord = "123456";

    public  void loginInfo(String userName,String passWord)
            throws PasswordException,UserNameException{
        if(!this.userName.equals(userName)) {
            //System.out.println("用户名错误！");
            //return;
            throw new UserNameException("用户名错误异常...");
        }

        if(!this.passWord.equals(passWord)) {
            //System.out.println("密码错误！");
            //return;
            throw new PasswordException("密码错误异常...");
        }

        System.out.println("登录成功！");
    }

    public static void main(String[] args) {
        Login login = new Login();
        try {
            login.loginInfo("admin","1234586");
        } catch (PasswordException e) {
            e.printStackTrace();
            System.out.println("PasswordException...");
        } catch (UserNameException e) {
            e.printStackTrace();
            System.out.println("UserNameException...");
        }
    }
}
